﻿$(initPage);
function initPage() {
	var timer=setTimeout(function(){
			location.reload();
		}, 30000);//1分钟自动刷新
		
	//生成文件
	$("#query").click(function() {
	$.post("m/submit_file/getfileInfo", {
  }, function(data) {
		if ($.checkErrorMsg(data) ) {
			var fileList = "";
      var backFileCount = data.backFileCount;
      if (backFileCount < 1){
          alert("今日还未发送文件！");
      } else {
			if(data.pfxBackInfoList){
				var dataList = data.pfxBackInfoList;
				$(dataList).each(function(i) {
					fileList += "<tr class='table_td_font' bgColor='#ffffff' onclick='selectTR(this)'>";
          fileList += "<td align='center'  height='25px' class='queryList_linebg' nowrap >" + (i+1) + "</td>";
					fileList += "<td align='center'  height='25px' class='queryList_linebg' nowrap >" + (getStatusDesc(dataList[i].status)) + "</td>";
					fileList += "<td align='center'  height='25px' class='queryList_linebg' nowrap >" + (dataList[i].fileName ? dataList[i].fileName : "") + "</td>";
					fileList += "<td align='center'  height='25px' class='queryList_linebg' nowrap >" + (dataList[i].fileSizeNote ? dataList[i].fileSizeNote : "") + "</td>";
					fileList += "<td align='center'  height='25px' class='queryList_linebg' nowrap >" + (dataList[i].fileDate ? dataList[i].fileDate : "") + "</td>";
					fileList += "<td align='center'  height='25px' class='queryList_linebg' nowrap >" + (dataList[i].fileUploadDate ? dataList[i].fileUploadDate : "") + "</td>";
					fileList += "<td align='center'  height='25px' class='queryList_linebg' nowrap >" + (dataList[i].fileSerialNo ? dataList[i].fileSerialNo : "") + "</td>";
					fileList += "<td align='center'  height='25px' class='queryList_linebg' nowrap >" + (dataList[i].dept ? dataList[i].dept : "") + "</td>";
					fileList += "</tr>";
				});
			  }
      }
			$("#data_list").html(fileList);
      }
	  }, "json");
  });
  $("#query").click();
}
function getStatusDesc(status) {
  var statusDesc = "";
	if (status == 'ini') {
		statusDesc = "未下载";
	} else if  (status == 'fin') {
		statusDesc = "已下载";
	} else {
    statusDesc = "未知状态";
  }
  return(statusDesc);
}

